package com.bwie.controller;

import com.bwie.common.domain.User;
import com.bwie.common.result.Result;
import com.bwie.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * @className: UserController
 * @Description: TODO
 * @version: v1.８.0
 * @author: 汪菲阳
 * @date: 2025/11/10 10:04
 */
@CrossOrigin
@RestController
@RequestMapping("user")
public class UserController {
    @Autowired
    private UserService userService;

    /**
     * 用户账号和密码登录
     * @param user
     * @return
     */
    @PostMapping("login")
    public Result<String> login(@RequestBody @Valid User user){
        return Result.success(userService.login(user));
    }
}
